$('#ListTitle').html(CurXingMing + '工作量审核列表');
$.getJSON('WorkShenHe_list.php', {
    person_id: CurPersonId
  },
  function(data, textStatus, jqXHR) {
    for (let i = 0; i < data.length; i++) {
      $('#ListArea').append(
        '<tr>  ' +
        '<td>' + data[i].BuMenName + '</td><td>' + data[i].XingMing + '</td><td>' + data[i].BeginTime + '</td><td>' + data[i].EndTime + '</td><td>' + data[i].ReferTime + '</td><td>' + data[i].Minutes + '分钟</td><td>' + data[i].NeiRong + '</td><td>' + data[i].Status + '</td><td>' + data[i].ShenHeTime + '</td>' +
        '  <td> ' +
        (data[i].StatusCode == '0' ? '    <a OptId="' + data[i].id + '" href="javascript:" class="btn btn-default btn-xs green work_agree"><i class="fa fa-check"></i>通过</a><a OptId="' + data[i].id + '" href="javascript:" class="btn btn-default btn-xs red work_disagree"><i class="fa fa-thumbs-down"></i>驳回</a> ' : '') +
        '  </td> ' +
        '</tr>'
      );
    }
    optAction();
  }
);
var OptId;

function optAction() {
  $('.work_agree').click(function() {
    OptId = $(this).attr('OptId');
    if (window.confirm('是否确认同意?')) {
      $.getJSON('work_agree.php', {
          OptId: OptId
        },
        function(data, textStatus, jqXHR) {
          $('.page-content').load('WorkShenHe_list.html');
        }
      );
    }
  })
  $('.work_disagree').click(function() {
    OptId = $(this).attr('OptId');
    if (window.confirm('是否确认驳回?')) {
      $.getJSON('work_disagree.php', {
          OptId: OptId
        },
        function(data, textStatus, jqXHR) {
          $('.page-content').load('WorkShenHe_list.html');
        }
      );
    }
  })
}
